package com.chuantou.yuba.api.to;

import com.chuantou.yuba.pojo.Cacheable;
import com.google.gson.annotations.SerializedName;

import android.os.Parcel;
import android.os.Parcelable;

public class BaseTO extends Cacheable implements Parcelable {
	// 成功状态码
	private static final int STATUS_SUCCESS = 1;
	// token过期码
	public static final int STATUS_TOKEN_EXPIRED = 1001;
	// token错误码
	public static final int STATUS_TOKEN_ERROR = 1002;
	@SerializedName("status")
	private int status;
	@SerializedName("msg")
	private String msg;

	public BaseTO() {
	}

	public BaseTO(Parcel source) {
		this.status = source.readInt();
		this.msg = source.readString();
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeInt(status);
		dest.writeString(msg);
	}

	public boolean isSuccess() {
		return STATUS_SUCCESS == status;
	}

	public static final Creator<BaseTO> CREATOR = new Creator<BaseTO>() {

		@Override
		public BaseTO[] newArray(int size) {
			return new BaseTO[size];
		}

		@Override
		public BaseTO createFromParcel(Parcel source) {
			return new BaseTO(source);
		}
	};

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	@Override
	public int getCurrentPage() {
		return 0;
	}

}
